//
//  MessageViewController.m
//  DefendHealth
//
//  Created by 吾诺翰卓003 on 17/2/21.
//  Copyright © 2017年 iMacOne. All rights reserved.
//

#import "MessageViewController.h"
#import "MessageTableViewCell.h"
@interface MessageViewController ()

@end

@implementation MessageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.baseTableView.frame = CGRectMake(0, 64, WindowWidth, WindowHeight-64);
    self.TitleNav.text = @"消息";
    UIButton *releaseBtn = [[UIButton alloc] initWithFrame:CGRectMake(WindowWidth-25-[ToolUtil autoWidth:@"好友" width:500 height:13 num:13], 20, [ToolUtil autoWidth:@"好友" width:500 height:13 num:13], 40)];
    [releaseBtn setTitle:@"好友" forState:UIControlStateNormal];
//    [releaseBtn addTarget:self action:@selector(release:) forControlEvents:UIControlEventTouchUpInside];
    releaseBtn.titleLabel.font = FONT(13);
    releaseBtn.titleLabel.textAlignment = 2;
    [releaseBtn setTitleColor:[ImageUtil colorWithRgb:0x333333] forState:0];
    [self.view addSubview:releaseBtn];
    
    UIView *hui = [UIView new];
    hui.frame = CGRectMake(12, 63.5,WindowWidth-24 , 0.5);
    hui.backgroundColor = kLineColor;
    [self.view addSubview:hui];
    
    [self addHeadView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)addHeadView{
    UIView *headView1 = [UIView new];
    
    headView1.backgroundColor = [UIColor whiteColor];
    
    NSArray *titleArr = @[@"收到的赞",@"收到的评论",@"转发与分享",@"收到的礼物"];
    for (int i = 0; i<titleArr.count; i++) {
        BaseView *view = [BaseView new];
        view.frame = CGRectMake(0, 0+47*i, WindowWidth, 47);
        view.backgroundColor = [UIColor whiteColor];
        [headView1 addSubview:view];
        
        UIImageView *img = [UIImageView new];
        img.frame = CGRectMake(25, 13, 21, 21);
        img.backgroundColor = [UIColor grayColor];
        [view addSubview:img];
        
        UILabel *lab1 = [UILabel new];
        lab1.frame = CGRectMake(kMaxX(img.frame)+14, 0, 118, 47);
        lab1.text = titleArr[i];
        lab1.font = FONT(12);
        lab1.textColor = UIColorFromRGB(0x333333);
        lab1.textAlignment = 0;
        [view addSubview:lab1];
        
        UILabel *Numlab1 = [UILabel new];
        Numlab1.frame = CGRectMake(WindowWidth-25-16, 15.5, 16, 16);
        Numlab1.text = @"1";
        Numlab1.font = FONT(9);
        Numlab1.textColor = UIColorFromRGB(0xffffff);
        Numlab1.textAlignment = 1;
        Numlab1.backgroundColor = UIColorFromRGB(0x231815);
        Numlab1.layer.cornerRadius = 8;
        Numlab1.layer.masksToBounds = YES;
        [view addSubview:Numlab1];
        
        UIView *hui = [UIView new];
        hui.frame = CGRectMake(12, 46.5,WindowWidth-24 , 0.5);
        hui.backgroundColor = kLineColor;
        [view addSubview:hui];
        
    }
    UIView *hui2 = [UIView new];
    hui2.frame = CGRectMake(0, 47*4,WindowWidth , 5);
    hui2.backgroundColor = kLineColor;
    [headView1 addSubview:hui2];
    
    headView1.frame = CGRectMake(0, 0,WindowWidth , kMaxY(hui2.frame));
    self.baseTableView.tableHeaderView = headView1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 47;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString * cellIden = @"MessageTableViewCell";
    MessageTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIden];
    if (cell == nil) {
        cell = [[MessageTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIden];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    cell.backgroundColor = [UIColor whiteColor];
    return cell;
}

@end
